<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="UserManager.aspx.vb" Inherits="GTSWeb_Admin_UserManager" title="GTS Frieght Management System"  MaintainScrollPositionOnPostback="true" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
    <h3>Administrator User management</h3>
    <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False"
        CellPadding="4" DataSourceID="ObjectDataSource1" Font-Size="10pt" ForeColor="#333333"
        GridLines="None" Width="90%" HorizontalAlign="Center" DataKeyNames="UserName">
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="UserName" SortExpression="UserName">
                <EditItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("UserName") %>' Width="100px"></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("Email") %>'
                        Text='<%# Eval("UserName") %>' Width="100px"></asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Client" SortExpression="ClientId">
                <EditItemTemplate><asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ddlClientDataSource"
                        DataTextField="ClientName" DataValueField="ClientID" SelectedIndex='<%# Bind("ClientId") %>'>
                </asp:DropDownList><asp:ObjectDataSource ID="ddlClientDataSource" runat="server"
                    OldValuesParameterFormatString="{0}" SelectMethod="getAllClients" TypeName="GTSSystem.BLL.Client">
                </asp:ObjectDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ddlClientDataSource"
                        DataTextField="ClientName" DataValueField="ClientID" SelectedIndex='<%# Bind("ClientId") %>' BackColor="White" Enabled="False" ForeColor="Black">
                    </asp:DropDownList><asp:ObjectDataSource ID="ddlClientDataSource" runat="server"
                        OldValuesParameterFormatString="original_{0}" SelectMethod="getAllClients" TypeName="GTSSystem.BLL.Client">
                    </asp:ObjectDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Role" SortExpression="Role">
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlRole" runat="server" DataSourceID="RolesDataSource"
                        SelectedValue='<%# Bind("Role") %>' Width="100px">
                    </asp:DropDownList><asp:ObjectDataSource ID="RolesDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="getAllRoles" TypeName="GTSSystem.BLL.User"></asp:ObjectDataSource>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:DropDownList ID="ddlRole" runat="server" DataSourceID="RolesDataSource"
                        Enabled="False" ForeColor="Black" SelectedValue='<%# Bind("Role") %>' Width="100px">
                    </asp:DropDownList><asp:ObjectDataSource ID="RolesDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
                        SelectMethod="getAllRoles" TypeName="GTSSystem.BLL.User"></asp:ObjectDataSource>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="FirstName" SortExpression="FirstName">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("FirstName") %>' Width="100px"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("FirstName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="LastName" SortExpression="LastName">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("LastName") %>' Width="100px"></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("LastName") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
          
    <asp:TemplateField>
	<ItemTemplate><asp:LinkButton id="cmdDel" runat="server" Text="Delete" CommandName="Delete" CausesValidation="false">
    </asp:LinkButton></ItemTemplate>
    </asp:TemplateField>
    
    <asp:CommandField ShowEditButton="True" />
            
            
        </Columns>
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <EditRowStyle BackColor="#999999" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
    </asp:GridView>
    <br />
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="{0}"
        SelectMethod="getAllUsers" TypeName="GTSSystem.BLL.User" UpdateMethod="UpdateUser" DeleteMethod="deleteUser">
        <UpdateParameters>
            <asp:Parameter Name="UserName" Type="String" />
            <asp:Parameter Name="ClientId" Type="Int32" />
            <asp:Parameter Name="BranchId" Type="Int32" />
            <asp:Parameter Name="Role" Type="String" />
            <asp:Parameter Name="FirstName" Type="String" />
            <asp:Parameter Name="LastName" Type="String" />
        </UpdateParameters>
        <DeleteParameters>
            <asp:Parameter Name="UserName" Type="String" />
        </DeleteParameters>
    </asp:ObjectDataSource>
</asp:Content>

